package com.jian.java.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author Jiange
 * @create 2021-04-29-13:41
 */
@RestController
@Slf4j
public class FormController {
    @PostMapping("/form")
    public String jian(String name, @RequestParam("pass") String pas, @RequestParam("shao") MultipartFile file,@RequestParam("duo") MultipartFile[] photo) throws IOException {
        System.out.println(name);
        System.out.println(pas);
        log.info("name={}, pass={} , photo={}, file={}",name,pas,photo,file);
        if(!file.isEmpty()){
            String originalFilename = file.getOriginalFilename();
            System.out.println(originalFilename);
        }
        return "";
    }
}
